<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Example Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="examples.html">Examples</a> &nbsp; </center>
<hr><h1>/TestCOMGraphan/Test2.cpp</h1>
<p>
<div class="fragment"><pre><span class="comment">/*</span>
<span class="comment"> This example shows how to load a string into graphematical module</span>
<span class="comment">*/</span>

<span class="preprocessor">#include &lt;stdio.h&gt;</span>
<span class="preprocessor">#include "string.h"</span>
<span class="preprocessor">#include &lt;string&gt;</span>
<span class="preprocessor">#include "assert.h"</span>
<span class="preprocessor">#import "../../bin/graphan.tlb"</span>
<span class="preprocessor"></span>
<span class="comment">// String Example</span>
<span class="keywordtype">int</span> main (<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[])
{
  <span class="keywordflow">try</span> 
  {
        <span class="comment">// init COM</span>
        CoInitialize(NULL);

        <span class="comment">// creating COM-object</span>
        GRAPHANLib::IGraphmatFilePtr piGraphan;
        HRESULT hr = piGraphan.CreateInstance(__uuidof(GRAPHANLib::GraphmatFile));
        <span class="keywordflow">if</span> (FAILED (hr))
        {
                printf (<span class="stringliteral">"Graphan is not registered"</span>);
                CoUninitialize();
                <span class="keywordflow">return</span> 1;
        };

        <span class="comment">// loading dictionaries </span>
        piGraphan-&gt;LoadDicts();

        <span class="comment">//  loading a string </span>
        piGraphan-&gt;LoadStringToGraphan(<span class="stringliteral">"mother goes to the windows"</span>);

        _bstr_t t = piGraphan-&gt;GetWord(3);

        assert (t == _bstr_t(<span class="stringliteral">"to"</span>));
  }
  <span class="keywordflow">catch</span>(...)
  {
                <span class="keywordflow">return</span> -1;
  }
  CoUninitialize();
  <span class="keywordflow">return</span> 1;
}
</pre></div><hr><address style="align: right;"><small>Generated on Sat Jun 25 17:04:48 2005 for Graphan by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.18 </small></address>
</body>
</html>
